#include <iostream>
#include <vector>
#include <deque>
#include <string>
#include <random>
#include <algorithm>
using namespace std;
template <typename Container>
void display(const Container &con)
{
    for (auto &ele : con)
    {
        cout << ele << " " << endl;
    }
    cout << endl;
}
class Person
{
public:
    Person(string n)
        : name(n), score(0)
    {
    }
    void setScore(double s){
        score = s;
    }
    string getname(){
        return name;
    }
    double getScore(){
        return score;
    }
private:
    string name;
    double score;
};
void test()
{
    random_device rd;
    mt19937 gen(rd());
    uniform_int_distribution<int> dist(1, 100);

    vector<Person> person;
    person.emplace_back("A");
    person.emplace_back("B");
    person.emplace_back("C");
    person.emplace_back("D");
    person.emplace_back("E");
    for (int i = 0; i < 5; i++)
    {
        deque<int> rate(10);
        int allscore = 0;
        for (auto &elem : rate)
        {
            elem = dist(gen);
        }
        sort(rate.begin(), rate.end());
        rate.pop_back();
        rate.pop_front();

        for (auto &elem : rate)
        {
            allscore += elem;
        }
        double average = allscore / 8;
        person[i].setScore(average);

        cout << "选手: "  << person[i].getname() <<"得分: "<< person[i].getScore()<<endl;
    }
}
int main()
{
    test();
    return 0;
}
